/isg; $c->{i} = $i; if ($c->{parent_id} > 0) { my $sth2 = $dbh_patent->prepare("select fio from comments where id = ?"); $sth2->execute($c->{parent_id}); $c->{parent_fio} = $sth2->fetchrow_array(); $sth2->finish; } push @{$rh_data->{comments}}, $c; } $sth->finish; $rh_data->{comment_i} = $i; return $rh_data; } sub show_patent { my $rh_data = shift; my $fine_text = ""; my $uniq_img = ""; my $sth2 = $dbh_patent->prepare("select * FROM doc where code = ?"); $sth2->execute($rh_data->{ret_val}->{code}); my $patent = $sth2->fetchrow_hashref(); $sth2->finish; $patent->{modif} =~ s/\ /T/is; if ($patent->{nodoc}) { exit(0); } if (!$patent->{name}) { $patent->{name} = "Полезная модель РФ " . $rh_data->{ret_val}->{code}; } $patent->{name} =~ s/<.*?>//isg; $patent->{comment} =~ s/<.*?>//isg; $patent->{comment} =~ s/\"/"/isg; $rh_data->{Title} = &main::lc_name($patent->{name}); $rh_data->{title_free} = $rh_data->{Title}; $rh_data->{title_free} =~ s/\"|\'//isg; my $dir = int($rh_data->{ret_val}->{code} / 10000); my $new = ""; # if ($patent->{fhtml}) { $new = "new/"; } open (F, "{ret_val}->{code}.html"); my @R =
"; if ($img->{url} =~ m/http/is) { $mst =~ s/href=\"$img->{url}\"/href=\"http\:\/\/img\.poleznayamodel\.ru\/img_data\/$dir_img\/$img->{id}\.$img->{ext_big}\" onClick=\"this.href=\'http\:\/\/poleznayamodel\.ru\/img_show\/$img->{id}\.html\';\" title=\"$rh_data->{title_free}\"/isg; } else { $mst =~ s/href=\"\/$img->{url}\"/href=\"http\:\/\/img\.poleznayamodel\.ru\/img_data\/$dir_img\/$img->{id}-s\.$img->{ext_big}\" onClick=\"this.href=\'http\:\/\/poleznayamodel\.ru\/img_show\/$img->{id}\.html\';\" title=\"$rh_data->{title_free}\"/isg; $mst =~ s/\/$img->{url}/http\:\/\/img\.poleznayamodel\.ru\/img_data\/$dir_img\/$img->{id}-s\.$img->{ext_small}/isg; $mst =~ s/$img->{url}/http\:\/\/img\.poleznayamodel\.ru\/img_data\/$dir_img\/$img->{id}-s\.$img->{ext_small}/isg; } if (length($img->{url_small}) < 2) { $img->{url_small} = $img->{url}; $img->{url_small} =~ s/\./\-s\./isg; $img->{url_small} =~ s/tif/gif/isg; # print $img->{url_small} . "
"; } $mst =~ s/\/$img->{url_small}/http\:\/\/img\.poleznayamodel\.ru\/img_data\/$dir_img\/$img->{id}-s\.$img->{ext_small}/isg; $mst =~ s/$img->{url_small}/http\:\/\/img\.poleznayamodel\.ru\/img_data\/$dir_img\/$img->{id}-s\.$img->{ext_small}/isg; # print $img->{url_small} . "
"; # print $img->{url} . "
"; } $sth2->finish; # TITLE="1 Kb" TI="AD" HE="49" WI="147" $mst =~ s/\ TITLE=\".*?\"//; $mst =~ s/\ TI=\".*?\"//; $mst =~ s/\ HE=\".*?\"//; $mst =~ s/\ WI=\".*?\"//; $mst =~ s/^.*?\(57\)\ Реферат:<\/P>//is; # print "AAAA" . $fine_text . "
"; # $mst =~ s/prepare("select distinct(b.codemain),b.price,b.c from dockw as a, kw_info as b where a.code = ? and a.deleted = false and a.kw_id = b.id and b.codemain != a.code order by b.price desc, b.c desc"); $sth2->execute($rh_data->{ret_val}->{code}); while (my ($kw_code, $price, $c) = $sth2->fetchrow_array()) { if ($p->{$kw_code}) { next; } else { $p->{$kw_code} = 1; } $flag = 1; my $sth3 = $dbh_patent->prepare("select * FROM doc where code = ?"); $sth3->execute($kw_code); my $p = $sth3->fetchrow_hashref(); $sth3->finish; $p->{kws} = &add_kws($p->{code}); $p->{dir} = int($p->{code} / 10000); my $sth4 = $dbh_patent->prepare("select * FROM doc_img where code = ? order by id asc"); $sth4->execute($p->{code}); my $img = $sth4->fetchrow_hashref(); $sth4->finish; $p->{name} =~ s/<.*?>//isg; $p->{comment} =~ s/<.*?>//isg; if ($img->{id}) { $p->{image_dir} = int($img->{id} / 10000); $p->{image_id} = $img->{id}; $p->{image_ext_small} = "gif"; if (!($img->{width_small})) { $img->{image_width_small} = 0; } if (!($img->{height_small})) { $img->{image_height_small} = 0; } $p->{image_width_small} = $img->{width_small}; $p->{image_height_small} = $img->{height_small}; if (($p->{image_width_small} > 100) and ($p->{width_small} > $p->{height_small})) { $p->{image_big} = 1; } } $p->{name} = &lc_name($p->{name}); $p->{i} = $i; $i++; if ($i > 1) { $i = 0; } push @patents, $p; } $sth2->finish; # if (!$flag) { if ($#patents < 20) { #обратное наполнение #заменить информацию о категориях $sth2 = $dbh_patent->prepare("select * FROM doc_class where code = ? order by class_code asc"); $sth2->execute($rh_data->{ret_val}->{code}); while (my $class = $sth2->fetchrow_hashref()) { my $sth3 = $dbh_patent->prepare("select c,name from class where id = ?"); $sth3->execute($class->{class_id}); ($class->{c}, $class->{name}) = $sth3->fetchrow_array(); $sth3->finish; if (!$flag) { $sth3 = $dbh_patent->prepare("select b.* FROM doc_class as a, doc as b where b.no_main = false and b.verify = true and (a.class_id = $class->{class_id} or a.class_code like '$class->{class_code}%') and a.patent_id = b.id and a.code != $rh_data->{ret_val}->{code} order by id asc limit 10"); $sth3->execute(); while (my $p = $sth3->fetchrow_hashref()) { $p->{kws} = &add_kws($p->{code}); $p->{dir} = int($p->{code} / 10000); my $sth4 = $dbh_patent->prepare("select * FROM doc_img where code = ? order by id asc"); $sth4->execute($p->{code}); my $img = $sth4->fetchrow_hashref(); $sth4->finish; $p->{name} =~ s/<.*?>//isg; $p->{comment} =~ s/<.*?>//isg; if ($img->{id}) { $p->{image_dir} = int($img->{id} / 10000); $p->{image_id} = $img->{id}; $p->{image_ext_small} = "gif"; if (!($img->{width_small})) { $img->{image_width_small} = 0; } if (!($img->{height_small})) { $img->{image_height_small} = 0; } $p->{image_width_small} = $img->{width_small}; $p->{image_height_small} = $img->{height_small}; if (($p->{image_width_small} > 100) and ($p->{width_small} > $p->{height_small})) { $p->{image_big} = 1; } } $p->{name} = &lc_name($p->{name}); $p->{i} = $i; $i++; if ($i > 1) { $i = 0; } push @patents, $p; } $sth3->finish; } $class->{name} =~ s/\#//isg; } $sth2->finish; } if ($#patents < 20) { #заменить информацию о категориях $sth2 = $dbh_patent->prepare("select * FROM doc_class where code = ? order by class_code desc"); $sth2->execute($rh_data->{ret_val}->{code}); while (my $class = $sth2->fetchrow_hashref()) { my $sth3 = $dbh_patent->prepare("select c,name from class where id = ?"); $sth3->execute($class->{class_id}); ($class->{c}, $class->{name}) = $sth3->fetchrow_array(); $sth3->finish; if (!$flag) { $sth3 = $dbh_patent->prepare("select b.* FROM doc_class as a, doc as b where b.no_main = false and b.verify = true and (a.class_id = $class->{class_id} or a.class_code like '$class->{class_code}%') and a.patent_id = b.id and a.code < $rh_data->{ret_val}->{code} order by a.code desc limit 5"); $sth3->execute(); while (my $p = $sth3->fetchrow_hashref()) { $p->{dir} = int($p->{code} / 10000); $p->{kws} = &add_kws($p->{code}); my $sth4 = $dbh_patent->prepare("select * FROM doc_img where code = ? order by id asc"); $sth4->execute($p->{code}); my $img = $sth4->fetchrow_hashref(); $sth4->finish; $p->{name} =~ s/<.*?>//isg; $p->{comment} =~ s/<.*?>//isg; if ($img->{id}) { $p->{image_dir} = int($img->{id} / 10000); $p->{image_id} = $img->{id}; $p->{image_ext_small} = "gif"; if (!($img->{width_small})) { $img->{image_width_small} = 0; } if (!($img->{height_small})) { $img->{image_height_small} = 0; } $p->{image_width_small} = $img->{width_small}; $p->{image_height_small} = $img->{height_small}; if (($p->{image_width_small} > 100) and ($p->{width_small} > $p->{height_small})) { $p->{image_big} = 1; } } $p->{name} = &lc_name($p->{name}); if (!$p->{name}) { $p->{name} = "Полезная модель $p->{code}"; } $p->{i} = $i; $i++; if ($i > 1) { $i = 0; } push @patents, $p; } $sth3->finish; } $class->{name} =~ s/\#//isg; my $url = ""; if ($class->{level0}) { $url .= $class->{level0} . "/"; } if ($class->{level1}) { $url .= $class->{level1} . "/"; } if ($class->{level2}) { $url .= $class->{level2} . "/"; } if ($class->{level3}) { $url .= $class->{level3} . "/"; } $url.="$class->{class_id}/"; $class->{url} = $url; push @{$rh_data->{class}}, $class; } $sth2->finish; } if ($#patents < 20) { #обратное наполнение #заменить информацию о категориях $sth2 = $dbh_patent->prepare("select * FROM doc_class where code = ? order by class_code asc"); $sth2->execute($rh_data->{ret_val}->{code}); while (my $class = $sth2->fetchrow_hashref()) { my $sth3 = $dbh_patent->prepare("select c,name from class where id = ?"); $sth3->execute($class->{class_id}); ($class->{c}, $class->{name}) = $sth3->fetchrow_array(); $sth3->finish; if (!$flag) { # print "select b.* FROM doc_class as a, doc as b where b.no_main != true and (a.class_id = $class->{class_id} or a.class_code like '$class->{class_code}%') and a.patent_id = b.id and a.code > $rh_data->{ret_val}->{code} order by id asc limit 10\n"; $sth3 = $dbh_patent->prepare("select b.* FROM doc_class as a, doc as b where b.no_main != true and (a.class_id = $class->{class_id} or a.class_code like '$class->{class_code}%') and a.patent_id = b.id and a.code != $rh_data->{ret_val}->{code} order by id asc limit 10"); $sth3->execute(); while (my $p = $sth3->fetchrow_hashref()) { $p->{kws} = &add_kws($p->{code}); $p->{dir} = int($p->{code} / 10000); my $sth4 = $dbh_patent->prepare("select * FROM doc_img where code = ? order by id asc"); $sth4->execute($p->{code}); my $img = $sth4->fetchrow_hashref(); $sth4->finish; $p->{name} =~ s/<.*?>//isg; $p->{comment} =~ s/<.*?>//isg; if ($img->{id}) { $p->{image_dir} = int($img->{id} / 10000); $p->{image_id} = $img->{id}; $p->{image_ext_small} = "gif"; if (!($img->{width_small})) { $img->{image_width_small} = 0; } if (!($img->{height_small})) { $img->{image_height_small} = 0; } $p->{image_width_small} = $img->{width_small}; $p->{image_height_small} = $img->{height_small}; if (($p->{image_width_small} > 100) and ($p->{width_small} > $p->{height_small})) { $p->{image_big} = 1; } } $p->{name} = &lc_name($p->{name}); $p->{i} = $i; $i++; if ($i > 1) { $i = 0; } push @patents, $p; } $sth3->finish; } $class->{name} =~ s/\#//isg; } $sth2->finish; } if ($#patents > 20) { $#patents = 20; } # } $rh_data->{patents} = \@patents; $sth2 = $dbh_patent->prepare("select * FROM doc_authors where code = ?"); $sth2->execute($rh_data->{ret_val}->{code}); while (my $authors = $sth2->fetchrow_hashref()) { my $sth3 = $dbh_patent->prepare("select * FROM authors where id = ?"); $sth3->execute($authors->{authors_id}); my $h = $sth3->fetchrow_hashref(); $sth3->finish; $sth3 = $dbh_patent->prepare("select count(*) FROM doc_authors where authors_id = ?"); $sth3->execute($authors->{authors_id}); $h->{c} = $sth3->fetchrow_array(); $sth3->finish; foreach (keys %$h) { $authors->{$_} = $h->{$_}; } push @{$rh_data->{authors}}, $authors; } $sth2->finish; $sth2 = $dbh_patent->prepare("select * FROM doc_owners where code = ?"); $sth2->execute($rh_data->{ret_val}->{code}); while (my $owners = $sth2->fetchrow_hashref()) { my $sth3 = $dbh_patent->prepare("select * FROM owners where id = ?"); $sth3->execute($owners->{owners_id}); my $h = $sth3->fetchrow_hashref(); $sth3->finish; $sth3 = $dbh_patent->prepare("select count(*) FROM doc_owners where owners_id = ?"); $sth3->execute($owners->{owners_id}); $h->{c} = $sth3->fetchrow_array(); $sth3->finish; foreach (keys %$h) { $owners->{$_} = $h->{$_}; } push @{$rh_data->{owners}}, $owners; } $sth2->finish; if ($mst =~ m/ФАКСИМИЛЬНОЕ\ /is) { $mst =~ s/ФАКСИМИЛЬНОЕ\ .*?$/<\/td><\/tr><\/table>/isg; $mst .= "
" . $uniq_img; } $mst =~ s/
.*?
/<\/div>/isg;
$mst =~ s/